package com.nbsaas.boot.data.data.entity;

import com.nbsaas.boot.code.annotation.FieldConvert;
import com.nbsaas.boot.code.annotation.FormAnnotation;
import com.nbsaas.boot.code.annotation.FormField;
import com.nbsaas.boot.jpa.data.entity.LongEntity;
import com.nbsaas.boot.jpa.data.entity.User;
import lombok.Data;
import org.hibernate.annotations.Comment;

import javax.persistence.*;
import java.util.Date;

@org.hibernate.annotations.Table(appliesTo = "sys_common_query_template_history", comment = "sql历史记录")
@Data
@FormAnnotation(model = "sql历史")
@Entity
@Table(name = "sys_common_query_template_history")
public class QueryTemplateHistory extends LongEntity {


    @JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
    @FieldConvert(classType = String.class)
    @ManyToOne(fetch = FetchType.LAZY)
    private QueryTemplate queryTemplate;

    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(columnDefinition = "TEXT")
    private String content;

    @JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
    @FieldConvert
    @ManyToOne(fetch = FetchType.LAZY)
    private User creator;


    @FormField(title = "添加时间", grid = true, width = "160", ignore = true)
    @Comment("添加时间")
    private Date addDate;

}
